//
// Created by edward on 23-3-20.
//

#ifndef LEARNOPENGL_CAMERA_H
#define LEARNOPENGL_CAMERA_H

#include "global.h"

class Shader;

class Camera {
public:
    enum class Dir {
        FORWARD,
        BACKWARD,
        LEFT,
        RIGHT,
        UP,
        DOWN,
    };
    Camera(const glm::vec3 &pos, float y = -M_PI_2, float p = 0.0f, const glm::vec3 &up = glm::vec3(0.0f, 1.0f, 0.0f), float speed = 2.5f);
    void lookAt(Shader* shader) const ;
    void move(float deltaTime, Dir d = Dir::FORWARD);
    void changeDir(float xoffset, float yoffset);

    const glm::vec3 &getCameraPos() const;

    const glm::vec3 &getCameraDir() const;

private:
    void updateDir();

    glm::vec3 cameraPos;
    float yaw, pitch;
    glm::vec3 cameraDir;
    glm::vec3 cameraUp;
    glm::vec3 cameraRight;
    float cameraSpeed;
    float sensitivity;
};


#endif //LEARNOPENGL_CAMERA_H
